<%--
 *  File:   DefaultTaskConditionAdd.jsp
 *  Author: David Zhang
 *  Date:   2002/02/22
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //Initial parameters.
  Category cat = Category.getInstance("jsp.DefaultTaskConditionAdd"); 
  String strModuleName = "BIEE";  
  String strTableName = "ovcondition";
	String privilegeCode = "Z0704";
%>



<%
	
  //Get userinfo from session.
  HashMap mapUserInfo = (HashMap) session.getAttribute("userinfo");
%>

<%@ include file="/inc/PageDefault.inc" %>

<html>
<head>
<title>DefaultTaskConditionAdd</title>
<PageFlow:CheckPageFlow pageName="defaulttaskconditionadd"/>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
  <script language="JavaScript" src="../js/FuncLib.js"></script>
  
<%@ include file="/inc/SummaryDivision.inc" %>

<%
  Vector conditionSummary = (Vector) pageContext.getAttribute("conditionsummary");
  if ( conditionSummary == null )  conditionSummary = new Vector();
  String defaulttaskid = request.getParameter("defaulttaskid");
  
  cat.debug("The conditionSummary is :" + conditionSummary);
  cat.debug("The defaulttaskid is :" + defaulttaskid);
  cat.debug("The strCurSearchName is :" + strCurSearchName);
  cat.debug("The strCurSearchValue is :" + strCurSearchValue);  
  cat.debug("The strCurOrderByCol is :" + strCurOrderByCol);
  cat.debug("The strCurOrderByType is :" + strCurOrderByType);
  cat.debug("The nCurMaxItem is :" + nCurMaxItem);  
  cat.debug("The nCurCount is :" + nCurCount);  
  cat.debug("The nCurPageNo is :" + nCurPageNo);
  cat.debug("The nCurTotalPage is :" + nCurTotalPage);
  cat.debug("The nCurEndIndex is :" + nCurEndIndex);
  cat.debug("The bCurHasPre is :" + bCurHasPre);
  cat.debug("The bCurHasNext is :" + bCurHasNext);
%>

<script language="JavaScript">

<% if ( defaulttaskid == null )
   { %>
  opener.refreshWindow();
  window.close();
<% } %>

function page_add()
{
  var frm = document.defaulttaskconditionaddform;
  if ( nullChecked(frm.addconditionids, frm.rowcount.value) )
  {
      alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_ADD")%>");
      return;
  }
  frm.actionname.value = "add";
  isRunning = true;
  frm.submit();
}

function select_all()
{
  var frm = document.defaulttaskconditionaddform;
  if ( typeof(frm.addconditionids) != "undefined" )
  {
      if ( ! frm.addconditionids.length > 0 )
      {
          frm.addconditionids.checked = true;
      }
      else
      {
          for (var i = 0; i <  frm.addconditionids.length; i++)
          {
              frm.addconditionids[i].checked = true;
          }
      }
  }
}

function clear_all()
{
  var frm = document.defaulttaskconditionaddform;
  if ( typeof(frm.addconditionids) != "undefined" )
  {
      if ( ! frm.addconditionids.length > 0 )
      {
          frm.addconditionids.checked = false;
      }
      else
      {
          for (var i = 0; i <  frm.addconditionids.length; i++)
          {
              frm.addconditionids[i].checked = false;
          }
      }
  }    
}

function page_summary(actionvalue, orderbyname)
{
  var frm = document.defaulttaskconditionaddform;
  var editform = summaryPrepare(frm, actionvalue, orderbyname);
  editform.action = "DefaultTaskConditionAdd.jsp?<%= OvalTools.randomURL() %>";
  isRunning = true;
  editform.target = "_self";
  editform.submit(); 
}
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0" height="100%">
	<form name="defaulttaskconditionaddform" method="post" action="../Dispatcher">
    <input type="hidden" name="pagename" value="defaulttaskconditionadd">
    <input type="hidden" name="actionname">    
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">     
   
    <input type="hidden" name="defaulttaskid" value="<%=JspHelper.filterNull( defaulttaskid )%>">      

  <tr> 
    <td valign="top"> 
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr><td class="summary_top"></td></tr>
      </table>
      <table width="100%" cellspacing="0" cellpadding="0">
        <%@ include file="/inc/SummarySearch.inc" %>
      </table>
      
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
          <tr class="deepblue-left"> 
          <td class="title_center">&nbsp;</td>
          <td class="title_center" width="15%"><a href="javascript:page_summary('orderby','conditioncode')"><%= label.getLabelName("L_ConditionCode") %></a></td>
          <td class="title_center" width="15%"><a href="javascript:page_summary('orderby','conditiontypename')"><%= label.getLabelName("L_ConditionType") %></a></td>
          <td class="title_center" width="65%"><a href="javascript:page_summary('orderby','conditiondesc')"><%= label.getLabelName("L_ConditionDesc") %></a></td>
        </tr>
        <tr> 
        <%
           int i = 0;
           String strClassType = "";   
           HashMap mapCondition = new HashMap();
           String strConditionId = "";          
        %>
        <logic:iterate id="condition" collection="<%= conditionSummary %>">                      
        <%
          mapCondition = (HashMap) pageContext.getAttribute("condition");             
          if( i % 2 == 1 )  strClassType = "td-listrom";             
          else  strClassType = "";
          i++;     
        %>
        <tr class="<%=JspHelper.filterNull( strClassType )%>">
          <td height="21">
            <input type="checkbox" name="addconditionids" value=<%=JspHelper.filterNull( mapCondition.get("conditionid") )%> class="normalradio" >
          </td>
          <td height="21">&nbsp;<%=JspHelper.filterNull( mapCondition.get("conditioncode") )%></td>
          <td height="21" width="15%">&nbsp;<%=JspHelper.filterNull( mapCondition.get("conditiontypename") )%></td>
          <td height="21" width="71%">&nbsp;<%=JspHelper.filterNull( mapCondition.get("conditiondesc") )%></td>
        </tr>
        </logic:iterate>  
           
      <%--  flipping page --%>
      <%@ include file="/inc/SummaryAction.inc" %>
      
      </table>
      
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr><td class="summary_top"></td></tr>
        <tr> 
          <td class="td_center">
            <a onclick="select_all()"><custom:button type="1" label="L_Saveall" imgsrc="saveall.gif" border="0" style="width:60"/></a>
            <a onclick="clear_all()"><custom:button type="1" label="L_Resetmarks" imgsrc="resetmarks.gif" border="0"/></a>
            <a onclick="page_add()"><custom:button type="1" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a> 
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>


